package com.yanqu.road.server.manger.assistant.handler;

import com.yanqu.road.pb.assistant.AssistantProto;
import com.yanqu.road.pb.estatewar.EstateWarProto;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.assistant.AssistantMgr;
import com.yanqu.road.server.manger.assistant.CrossActionHandler;

/**
 * 小助手皇城膜拜跨服处理
 *
 * @author hgd
 */
public class WorshipCrossActionHandler extends CrossActionHandler {

    public WorshipCrossActionHandler() {
        this.success = false;
    }

    @Override
    protected void action(GamePlayer player, AssistantProto.AssistantActionReqMsg.Builder reqMsg, AssistantProto.AssistantActionRespMsg.Builder respMsg) {
        if (AssistantMgr.includeWorshipAction(reqMsg.getOperateEnumList())) {
            EstateWarProto.PalaceWorshipRespMsg.Builder palaceWorshipRespMsg = EstateWarProto.PalaceWorshipRespMsg.newBuilder();
            int ret = AssistantMgr.worshipAction(player, reqMsg, respMsg);
            if (ret != 0) {
                palaceWorshipRespMsg.setRet(ret);
                respMsg.setPalaceWorshipRespMsg(palaceWorshipRespMsg);
            } else {
                success = true;
            }
        }
    }

    @Override
    protected void nextHandler(GamePlayer player, AssistantProto.AssistantActionReqMsg.Builder reqMsg, AssistantProto.AssistantActionRespMsg.Builder respMsg) {
        new EscortCrossActionHandler().handle(player, reqMsg, respMsg);
    }

}
